package com.monkey.web.context.strategy;

import com.monkey.core.web.response.MonkeyResponseDto;

import java.util.List;

/**
 * Project  : monkey
 * Author   : Wu Tian Qiang
 * Date     : 2016/9/1
 */
public class ListCtrlReturnValueHandler extends AbstractCtrlReturnValueHandler {

    @Override
    public boolean support(Object returnValue) {
        return returnValue instanceof List;
    }

    @Override
    public MonkeyResponseDto handle(Object returnValue, String fieldStr) {
        List list = (List) returnValue;
        List<Object> dataList = exportResultList(fieldStr, list);
        return new MonkeyResponseDto().success("操作成功", dataList);
    }

}
